


//
//  homeccell.swift
//  mywei
//
//  Created by myd on 15/12/21.
//  Copyright © 2015年 myd1. All rights reserved.
//

import UIKit

class homeccell : hometitlecell {
    
   override var weibodata : homeweimessage? {
        didSet{
            
            if let ff = weibodata?.retweeted_status{
                
       uilab.text = "@\(ff.users!.screen_name!):\(ff.text!)"}
            
        }
    }
    lazy var button : UIButton =
        {
   let btn = UIButton()
            btn.backgroundColor = UIColor(white: 0.88, alpha: 1)
            return btn}()
    
    lazy var uilab : UILabel = {
   let lab = UILabel()
        lab.backgroundColor = UIColor(white: 0.99, alpha: 1)
        lab.numberOfLines=0
        lab.backgroundColor = UIColor.clearColor()
        lab.font = UIFont.systemFontOfSize(13)
        lab.textColor = UIColor.grayColor()
        return lab
    }()
    override func setpp() {
        super.setpp()
        contentView.addSubview(button)
        contentView.addSubview(uilab)
        contentView.sendSubviewToBack(button)
//        button.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: top1, size: nil, offset: CGPointMake(-8,8))
//        button.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bom, size: nil)
//        
//        uilab.ff_AlignInner(type: ff_AlignType.TopLeft, referView: button, size: nil, offset: CGPointMake(8, 8))
//        contentView.addConstraint(NSLayoutConstraint(item: uilab, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 0, constant: UIScreen.mainScreen().bounds.size.width-16))
        
        button.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: textlab, size: nil, offset: CGPoint(x: -8, y: 8))
        
        button.ff_AlignVertical(type: ff_AlignType.TopRight, referView: bom, size: nil)
        
        uilab.ff_AlignInner(type: ff_AlignType.TopLeft, referView: button, size: nil, offset: CGPoint(x: 8, y: 8))
        contentView.addConstraint(NSLayoutConstraint(item: uilab, attribute: NSLayoutAttribute.Width, relatedBy: NSLayoutRelation.Equal, toItem: nil, attribute: NSLayoutAttribute.NotAnAttribute, multiplier: 1, constant: UIScreen.mainScreen().bounds.width - 2 * 8))
        
   let con =    Collection.ff_AlignVertical(type: ff_AlignType.BottomLeft, referView: uilab, size: CGSizeMake(290, 290), offset: CGPointMake(0, 8))
        
        pre = Collection.ff_Constraint(con, attribute: NSLayoutAttribute.Height)!
        prew = Collection.ff_Constraint(con, attribute: NSLayoutAttribute.Width)!
    }
}